<?php

namespace app\api\model;

/**
 * 资金日志模型
 * Class Category
 * @package app\common\model
 */
class BalanceLog extends BaseModel
{
    protected $table = 'content_balance_log';
    public function getBalacnLog($uid){
        $data=$this->where('uid',$uid)->order('create_time desc')->select();
        foreach ($data as $key=>$value){
            if($value['type']==1){//1充值 2提现
                $data[$key]['price']=$value['after']-$value['front'];
                $data[$key]['remark']='充值成功';
            } else{
                $data[$key]['price']=$value['front']-$value['after'];
                $data[$key]['remark']='提现成功';
            }
            $value['create_time']=date('Y-m-d H:i:s',$value['create_time']);
        }
        return $data;
    }
}
